home *** CD-ROM | disk | FTP | other *** search
/ Libris Britannia 4 / science library(b).zip / science library(b) / INFO / DOSTIPS3.ZIP / DOSSCTY.TXT < prev    next >
Text File  |  1985-11-24  |  8KB  |  185 lines

  1.                        Come Out of Hiding
  2.        (PC Magazine Vol 4 No 22 October 29, 1985 PC Tutor)
  3.  
  4.      Copy-protected software that can be installed on a hard disk
  5. often creates "hidden" files.  These files do not show up in a DIR
  6. listing, so they cannot be deleted with the DEL command, but they
  7. prevent RMDIR from removing the directory.  You can see these files
  8. by running CHKDSK with the /V parameter.  Microsoft Word's installation
  9. program creates four hidden files in a subdirectory names \MSTOOLS.
  10. These are MW.COM, MW.COD, MW.DAT and MWA.
  11.      REVEAL.COM, created with DEBUG, will turn hidden files into
  12. normal files.  You can then delete them.  When running REVEAL, one
  13. and only one space must separate the word REVEAL from the filename
  14. (with optional drive and path indicators), thus:
  15.           REVEAL C:\MSTOOLS\MW.COM
  16. The program does not report errors -- if you see the file when you do
  17. a DIR listing, you know the program worked.
  18.      To summarize: run CHKDSK/V to see the hidden files; use REVEAL
  19. to change them to normal files; get rid of them with DEL; and finally
  20. remove the subdirectory with RMDIR.
  21.      You must use this technique with caution for other copy-protected
  22. programs.  Since some such programs cannot be installed on a hard disk
  23. a second time, you should be absolutely sure that removing the hidden
  24. files from your hard disk is really what you want.
  25.  
  26. A>DEBUG
  27. -A 100
  28. xxxx:0100  MOV SI,0080
  29. xxxx:0103  MOV BL,[SI]
  30. xxxx:0105  SUB BH,BH
  31. xxxx:0107  MOV BP [SI+BX+1],0
  32. xxxx:010C  MOV DX,0082
  33. xxxx:010F  MOV CX,0000
  34. xxxx:0112  MOV AL,01
  35. xxxx:0114  MOV AH,43
  36. xxxx:0116  INT 21
  37. xxxx:0118  INT 20
  38. xxxx:011A
  39. -N REVEAL.COM
  40. -R CX
  41. CX 0000
  42. :001A
  43. -W
  44. Writing 001A bytes
  45. -Q
  46.  
  47. -----------------------------------------------------------------
  48.                          File Protector
  49.        (PC Magazine Vol 4 No 25 Dec 10, 1985 User-to-User)
  50.  
  51.      Hidden files are immune to deletion, but they're also invisible
  52. to the DIR command, and you can't tell that they're there unless you
  53. have access to a special utility.  The routine below uses DOS Interrupt
  54. 43h to alter the attribute byte of a file and make it read-only.  The
  55. protection is not infallible (you can easily write over a file with a
  56. program that has the same name).  However, any file protected this way
  57. can be listed by DIR but is invisible to the DEL command.  This trick
  58. protects files only; to create another utility that will unprotect
  59. them, change the  MOV CX,21  line to  MOV CX,20  and the  N PERM.COM
  60. line to  N UNPERM.COM.
  61.      If you turn on the hidden file attribute for a subdirectory entry,
  62. the subdirectory remains hidden to casual users, but you can still CD
  63. to it, add or delete files in it, place it on your PATH, and execute
  64. programs in it from other subdirectories.  This can be useful when you
  65. want to keep several programs in a semi-protected state.
  66.      Editor's Note:  You don't need a special utility to see what
  67. hidden files are on your disk.  Just type CHKDSK/V and they'll all
  68. show up (along with all the other files on your disk).  To create the
  69. PERM.COM and UNPERM.COM files, type the instructions into a file called
  70. SCRIPT, then make the two changes in the text above and create another
  71. file called SCRIPT2.  Then use DEBUG 2.0 or later and type
  72. DEBUG < SCRIPT.  Then, on the next line, type  DEBUG < SCRIPT2  to
  73. create the files.  To use them, type  PERM filename  to protect the
  74. file, and  UNPERM filename  to unprotect it.  Trying to delete a
  75. PERMed file will result in the message, "Access denied."
  76.  
  77. A 100
  78. MOV BX,80
  79. INC BX
  80. CMP BYTE PTR [BX],20
  81. JZ 103
  82. MOV DX,BX
  83. INC BX
  84. CMP BYTE PTR [BX],0D
  85. JZ 116
  86. CMP BYTE PTR [BX],20
  87. JNZ 10B
  88. MOV BYTE PTR [BX],0
  89. MOV CX,21             (Change to  MOV CX,20  for UNPERM.COM)
  90. MOV AL,1
  91. MOV AH,43
  92. INT 21
  93. INT 20
  94.  
  95. RCX
  96. 24
  97. N PERM.COM   (Change to  N UNPERM.COM  for UNPERM.COM)
  98. W
  99. Q
  100.  
  101. -----------------------------------------------------------------
  102.                          Security Trick
  103.        (PC Magazine Vol 4 No 24 Nov 26, 1985 User-to-User)
  104.  
  105.      It's fairly simple to prevent a nonexpert from using your system.
  106. The trick involves using DEBUG to patch COMMAND.COM.
  107.      When DOS boots, it looks to see whether an AUTOEXEC.BAT file is in
  108. your root directory; if it is, DOS passes control to it.  So the first
  109. thing you have to do is patch COMMAND.COM so it looks for another .BAT
  110. file, such as SAMPLE.BAT:
  111.  
  112. DEBUG COMMAND.COM
  113. E 1078 "SAMPLE.BAT  "
  114. W
  115. Q
  116.      Note that there are two blank spaces between the .BAT and the
  117. second set of quotation marks.  These spaces are needed, since
  118. SAMPLE.BAT is two letters shorter than AUTOEXEC.BAT.  If the name of
  119. your new boot program is shorter than 11 characters (actually 12
  120. including the period), be sure to pad the new name with enough extra
  121. spaces to add up to all 12 characters.
  122.      An example of a new SAMPLE.BAT boot program that would shock an
  123. unauthorized user is:
  124.  
  125. ECHO OFF
  126. CLS
  127. ECHO Unauthorized Access !!
  128. ECHO Damage will result
  129. ECHO if you do not turn
  130. ECHO this computer off
  131. ECHO immediately !!
  132. ECHO 5
  133. ECHO 4
  134. ECHO 3
  135. ECHO 2
  136. ECHO 1
  137. ECHO 0
  138. CLS
  139. PROMPT Error
  140.  
  141.      If the user manages to get through this shock, further tricks can
  142. thwart access to your files.  Since the first thing most users do with
  143. an unfamiliar system is execute a DIR command, you can alter
  144. COMMAND.COM to change DIR to CAT (for CATalog), and change the error
  145. message that will result when DOS sees the now unknown command DIR.
  146. At the DOS prompt, type:
  147.  
  148. DEBUG COMMAND.COM
  149. E 3ADD "CAT"
  150. E 367C "Unauthorized Access !  "
  151. W
  152. Q
  153.      As with the previous example, if your new message is shorter than
  154. the existing one, add trailing blanks.  You can use the CAT command
  155. yourself to replace the standard DIR command; all an unauthorized user
  156. will get by typing in DIR is an "Error" prompt and the new error
  157. message you've created.
  158.      Editor's Note:  The addresses given above are for DOS 2.1 only,
  159. but it's simple to use the DEBUG S (Search) command to find the
  160. patching locations in other versions of DOS.  First type:  DEBUG
  161. COMMAND.COM.  At the DEBUG prompt, type RXC <Enter>.  DEBUG will print
  162. out the length of your COMMAND.COM file in hex notation.  Hit the
  163. Enter key again to get the prompt back.  Then, to search for the
  164. location of AUTOEXEC.BAT, type:  S 100 xxxx "AUTOEXEC" (but be sure
  165. to substitute the hex length RCX specified in place of the xxxx).  Use
  166. the same trick to search for the DIR command and the "Bad command or
  167. filename" message.
  168.      DEBUG will search through your file and print out the address of
  169. any matching strings of characters it finds.  In the case of something
  170. liek DIR, it will find several occurrences, so you have to figure out
  171. which one to replace.  You can do this by using the DEBUG D (Dump)
  172. command.  Just type D yyyy (substituting an address the S command
  173. specified in place of the yyyy).  The proper DIR is the one immediately
  174. followed by other DOS commands such as RENAME and REN.  In DOS 3.1,
  175. for instance, AUTOEXEC.BAT is at address 130F, DIR at 4D11, and the
  176. "Bad command ..." message at 4750.
  177.      Using the PROMPT Error trick is indeed nasty, but especially
  178. with a fast machine like the AT, the SAMPLE.BAT batch file goes by
  179. almost too quickly to read.  In addition, the initial ECHO OFF is a
  180. tipoff that a batch file is doing the mischief.  This trick is
  181. presumably for a hard disk system; all an experienced user has to do
  182. to circumvent it is stick a normal DOS disk in drive A: and boot the
  183. system with a conventional COMMAND.COM.  Still, the CAT trick is a
  184. good one, and it will keep the quick snoops away.
  185.